import { ChangeDetectionStrategy, Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';

@Component({
  selector: 'cne-exception-404',
  standalone: true,
  imports: [
    CommonModule,
    RouterModule,
    MatButtonModule,
    MatIconModule
  ],
  template: `
    <div class="exception-container">
      <div class="exception-content">
        <mat-icon class="error-icon">error_outline</mat-icon>
        <h1>404</h1>
        <h2>页面未找到</h2>
        <p>抱歉，您访问的页面不存在或已被移除。</p>
        <div class="exception-actions">
          <button mat-raised-button color="primary" routerLink="/home">
            <mat-icon>home</mat-icon>
            返回首页
          </button>
          <button mat-button (click)="goBack()">
            <mat-icon>arrow_back</mat-icon>
            返回上页
          </button>
        </div>
      </div>
    </div>
  `,
  styles: [`
    .exception-container {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      background-color: #f0f2f5;
    }
    
    .exception-content {
      text-align: center;
      padding: 48px;
      background: white;
      border-radius: 12px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
      max-width: 500px;
    }
    
    .error-icon {
      font-size: 80px;
      width: 80px;
      height: 80px;
      color: #f44336;
      margin-bottom: 24px;
    }
    
    h1 {
      font-size: 4rem;
      font-weight: 300;
      color: #1976d2;
      margin: 0 0 16px 0;
    }
    
    h2 {
      font-size: 1.5rem;
      font-weight: 500;
      color: #333;
      margin: 0 0 16px 0;
    }
    
    p {
      color: #666;
      font-size: 1rem;
      line-height: 1.6;
      margin-bottom: 32px;
    }
    
    .exception-actions {
      display: flex;
      gap: 1rem;
      justify-content: center;
    }
    
    button {
      padding: 12px 24px;
      font-size: 1rem;
    }
  `],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class Exception404Component {
  goBack(): void {
    window.history.back();
  }
}
